/**
 * 简单生产领料出库单
 */
import request from '@/utils/httpRequest.js';
import axiosRequest from "@/utils/axiosRequest.js";

/**
 * 2025-03-26
 */


//分页查询生产工单列表信息
export function reqPurchaseReceiptsList(parameter){
    return request({
        url:"/workOrderTakeOut/list",
        method:"post",
        data:{
            page:parameter.page,
            size:parameter.size,
            workOrderNumber:parameter.workOrderNumber,
            customFieldOne:parameter.customFieldOne
        }
    })
}

// 获取生产工单详情
export function reqWorkOrderReceiptsDetail(parameter){
    return request({
        url:"/workOrderTakeOut/detail",
        method:"get",
        params:{
            workOrderNumber:parameter.workOrderNumber
        }
    })
}

// 获取生产工单bom物料
export function reqWorkOrderReceiptsBom(parameter){
    return request({
        url:"/workOrderTakeOut/bom",
        method:"get",
        params:{
            workOrderNumber:parameter.workOrderNumber
        }
    })
}


//获取当前申请人
export function reqCurrentPerson(){
    return request({
        url:"/api/users/current",
        method:"get"
    })
}

//获取申请人列表信息
export function reqUserList(){
    return request({
        url:"/api/users/list",
        method:"get",
        params:{
            page:1,
            size:100,
            nickname:""
        }
    })
}

//获取默认领料出库单号
export function reqDefaultPurchaseCode(){
    return request({
        url:"/workOrderTakeOut/seCode",
        method:"get"
    })
}


//获取仓库列表信息
export function reqWarehouseList(){
    return request({
        url:"/workOrderTakeOut/warehouse/all",
        method:"get"
    })
}
//获取生产领料出库单状态数量
export function reqWorkOrderStatusNum(){
    return request({
        url:"/workOrderTakeOut/menu/num",
        method:"get"
    })
}
//获取出库单列表
export function reqWorkOrderTakeOutList(parameter){
    return request({
        url:"/workOrderTakeOut/in/list",
        method:"get",
        params:parameter
    })
}

//获取出库单详情
export function reqWorkOrderDetail(purchaseId){
    return request({
        url:"/workOrderTakeOut/in/detail",
        method:"get",
        params:{
            id:purchaseId
        }
    })
}

//创建领料出库单
export function reqCreateWorkOrder(parameter){
    return request({
        url:"/workOrderTakeOut/create",
        method:"post",
        data:parameter
    })
}

// 创建并完成领料出库单
export function reqCreateInWorkOrder(parameter){
    return request({
        url:"/workOrderTakeOut/in/create",
        method:"post",
        data:parameter
    })
}

// 编辑领料出库单
export function reqUpdateWorkOrder(parameter){
    return request({
        url:"workOrderTakeOut/update",
        method:"post",
        data:parameter
    })
}

//获取平台编码解析规则
export const reqScanCodeRuleInfo = (flagCode) => {
    if(!flagCode){
        flagCode = 'workOutWarehousing.handleBarcodeScan.new';
    }
    return axiosRequest({
        url:"/wms/stocks/scan/code/rule/get",
        method:"post",
        data:{
            code:flagCode
        },
        headers:{
            'jun-path':2
        }
    })
}

//生产订单列表接口
export function reqProductOrderList(parameter){
    return request({
        url:"/workOrderTakeOut/list2",
        method:"post",
        data:parameter
    })
}
//生产订单详情
export function reqProductOrderDetail(productOrderNumber){
    return request({
        url:"/workOrderTakeOut/detail2",
        method:"get",
        params:{
            productOrderNumber
        }
    })
}
//根据生产订单查询bom
export function reqBomByProductOrder(productOrderNumber){
    return request({
        url:"/workOrderTakeOut/bom2",
        method:"get",
        params:productOrderNumber
    })
}